/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package warmachinesystem.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;

import warmachinesystem.*;
import warmachinesystem.ArmyList;
import warmachinesystem.BaseUnitTierElement;
import warmachinesystem.GameSystem;
import warmachinesystem.Solo;
import warmachinesystem.SpecialRule;
import warmachinesystem.TBFieldAllowanceDelta;
import warmachinesystem.TBFieldAllowanceRelativeDelta;
import warmachinesystem.TBFreeUnit;
import warmachinesystem.TBInGameRule;
import warmachinesystem.TRUnitType;
import warmachinesystem.TierLevel;
import warmachinesystem.TierLevelType;
import warmachinesystem.TierList;
import warmachinesystem.Unit;
import warmachinesystem.UnitAttachment;
import warmachinesystem.UnitKind;
import warmachinesystem.UnitRule;
import warmachinesystem.UnitRuleType;
import warmachinesystem.Warcaster;
import warmachinesystem.Warjack;
import warmachinesystem.WarmachineSystemFactory;
import warmachinesystem.WarmachineSystemPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class WarmachineSystemFactoryImpl extends EFactoryImpl implements WarmachineSystemFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static WarmachineSystemFactory init() {
		try {
			WarmachineSystemFactory theWarmachineSystemFactory = (WarmachineSystemFactory)EPackage.Registry.INSTANCE.getEFactory("http://warmachinesystem/1.0"); 
			if (theWarmachineSystemFactory != null) {
				return theWarmachineSystemFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new WarmachineSystemFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WarmachineSystemFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case WarmachineSystemPackage.GAME_SYSTEM: return createGameSystem();
			case WarmachineSystemPackage.ARMY_LIST: return createArmyList();
			case WarmachineSystemPackage.WARCASTER: return createWarcaster();
			case WarmachineSystemPackage.WARJACK: return createWarjack();
			case WarmachineSystemPackage.UNIT: return createUnit();
			case WarmachineSystemPackage.SOLO: return createSolo();
			case WarmachineSystemPackage.UNIT_ATTACHMENT: return createUnitAttachment();
			case WarmachineSystemPackage.SPECIAL_RULE: return createSpecialRule();
			case WarmachineSystemPackage.UNIT_RULE: return createUnitRule();
			case WarmachineSystemPackage.TIER_LIST: return createTierList();
			case WarmachineSystemPackage.TIER_LEVEL: return createTierLevel();
			case WarmachineSystemPackage.TR_UNIT_TYPE: return createTRUnitType();
			case WarmachineSystemPackage.TR_NO_UNIT_TYPE: return createTRNoUnitType();
			case WarmachineSystemPackage.BASE_UNIT_TIER_ELEMENT: return createBaseUnitTierElement();
			case WarmachineSystemPackage.TB_FREE_UNIT: return createTBFreeUnit();
			case WarmachineSystemPackage.TB_FIELD_ALLOWANCE_DELTA: return createTBFieldAllowanceDelta();
			case WarmachineSystemPackage.TB_FIELD_ALLOWANCE_RELATIVE_DELTA: return createTBFieldAllowanceRelativeDelta();
			case WarmachineSystemPackage.TB_POINT_COST_DELTA: return createTBPointCostDelta();
			case WarmachineSystemPackage.TB_IN_GAME_RULE: return createTBInGameRule();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case WarmachineSystemPackage.UNIT_RULE_TYPE:
				return createUnitRuleTypeFromString(eDataType, initialValue);
			case WarmachineSystemPackage.TIER_LEVEL_TYPE:
				return createTierLevelTypeFromString(eDataType, initialValue);
			case WarmachineSystemPackage.UNIT_KIND:
				return createUnitKindFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case WarmachineSystemPackage.UNIT_RULE_TYPE:
				return convertUnitRuleTypeToString(eDataType, instanceValue);
			case WarmachineSystemPackage.TIER_LEVEL_TYPE:
				return convertTierLevelTypeToString(eDataType, instanceValue);
			case WarmachineSystemPackage.UNIT_KIND:
				return convertUnitKindToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GameSystem createGameSystem() {
		GameSystemImpl gameSystem = new GameSystemImpl();
		return gameSystem;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ArmyList createArmyList() {
		ArmyListImpl armyList = new ArmyListImpl();
		return armyList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Warcaster createWarcaster() {
		WarcasterImpl warcaster = new WarcasterImpl();
		return warcaster;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Warjack createWarjack() {
		WarjackImpl warjack = new WarjackImpl();
		return warjack;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Unit createUnit() {
		UnitImpl unit = new UnitImpl();
		return unit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Solo createSolo() {
		SoloImpl solo = new SoloImpl();
		return solo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitAttachment createUnitAttachment() {
		UnitAttachmentImpl unitAttachment = new UnitAttachmentImpl();
		return unitAttachment;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SpecialRule createSpecialRule() {
		SpecialRuleImpl specialRule = new SpecialRuleImpl();
		return specialRule;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitRule createUnitRule() {
		UnitRuleImpl unitRule = new UnitRuleImpl();
		return unitRule;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TierList createTierList() {
		TierListImpl tierList = new TierListImpl();
		return tierList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TierLevel createTierLevel() {
		TierLevelImpl tierLevel = new TierLevelImpl();
		return tierLevel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TRUnitType createTRUnitType() {
		TRUnitTypeImpl trUnitType = new TRUnitTypeImpl();
		return trUnitType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TRNoUnitType createTRNoUnitType() {
		TRNoUnitTypeImpl trNoUnitType = new TRNoUnitTypeImpl();
		return trNoUnitType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BaseUnitTierElement createBaseUnitTierElement() {
		BaseUnitTierElementImpl baseUnitTierElement = new BaseUnitTierElementImpl();
		return baseUnitTierElement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TBFreeUnit createTBFreeUnit() {
		TBFreeUnitImpl tbFreeUnit = new TBFreeUnitImpl();
		return tbFreeUnit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TBFieldAllowanceDelta createTBFieldAllowanceDelta() {
		TBFieldAllowanceDeltaImpl tbFieldAllowanceDelta = new TBFieldAllowanceDeltaImpl();
		return tbFieldAllowanceDelta;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TBFieldAllowanceRelativeDelta createTBFieldAllowanceRelativeDelta() {
		TBFieldAllowanceRelativeDeltaImpl tbFieldAllowanceRelativeDelta = new TBFieldAllowanceRelativeDeltaImpl();
		return tbFieldAllowanceRelativeDelta;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TBPointCostDelta createTBPointCostDelta() {
		TBPointCostDeltaImpl tbPointCostDelta = new TBPointCostDeltaImpl();
		return tbPointCostDelta;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TBInGameRule createTBInGameRule() {
		TBInGameRuleImpl tbInGameRule = new TBInGameRuleImpl();
		return tbInGameRule;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitRuleType createUnitRuleTypeFromString(EDataType eDataType, String initialValue) {
		UnitRuleType result = UnitRuleType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertUnitRuleTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TierLevelType createTierLevelTypeFromString(EDataType eDataType, String initialValue) {
		TierLevelType result = TierLevelType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertTierLevelTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitKind createUnitKindFromString(EDataType eDataType, String initialValue) {
		UnitKind result = UnitKind.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertUnitKindToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WarmachineSystemPackage getWarmachineSystemPackage() {
		return (WarmachineSystemPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static WarmachineSystemPackage getPackage() {
		return WarmachineSystemPackage.eINSTANCE;
	}

} //WarmachineSystemFactoryImpl
